www.gusucode.com > Introductory Communication Systems Course Using SDR工具箱 > Introductory Communication Systems Course Using SDR/Lab04/example_plot_Pb_vs_EbNo_BPSK.m

    %% example_plot_Pb_vs_EbNo_BPSK.m
%   Example script that plots bit error probability curve
%    for BPSK.
%
%   Cory J. Prust, Ph.D.
%   Last Modified:  7/18/2018

clear all
close all

%% set range for Eb/No values
EbN0_dB = 0:0.1:12;
EbN0 = 10.^(EbN0_dB/10);  % convert to linear units

%% compute probability of bit error
Pe = qfunc(sqrt(2*EbN0));

%% plot
semilogy(EbN0_dB, Pe)
grid on
xlabel('E_b/N_0 (dB)')
ylabel('probability of bit error')